<?php

require_once  $_SERVER['DOCUMENT_ROOT']."/../_lib/base/common.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.template.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.holidays.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.destinations.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.weather.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.hotels.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.photos.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.reviews.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.lurls.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.tree.php";
require_once SITE_ROOT_PATH."/_lib/classes/class.breadcrumb.php";




	$destinations = new destinations();
	$hotels = new hotels();
	$lurls = new lurls();
	$tree = new tree();
	$reviews = new reviews();
	$photos = new photos();
	$breadcrumb = new breadcrumb();
	
	// get the hotel values
	$params['tree_id'] = $_GET['tree_id'];
	$hotel_values = $tree->get_branch($params);
	$hotel_values = $hotel_values[0];
	unset($params);
	
	// If not found then send to 404 error
	if(!$hotel_values){
		header("HTTP/1.0 404 Not Found"); 
		include($_SERVER['DOCUMENT_ROOT']."/404.php");
		exit;
	}
	
	// get parent resort
	$params['type_id'] = '2';
	$params['tree_id'] = $hotel_values['parent_id'];
	$resort_values = $tree->get_branch($params);
	$resort_values = $resort_values[0];
	unset($params);
	
	// get parent destination
	$params['type_id'] = '1';
	$params['tree_id'] = $resort_values['parent_id'];
	$destination_values = $tree->get_branch($params);
	$destination_values = $destination_values[0];
	unset($params);
	
	
	// get photos
	$hotel_photos = $photos->get_photos($hotel_values['tree_id']);
	$lead_hotel_thumb_url = UPLOAD_HTTP_PERM.$hotel_photos[0]['photo_url_thumb'];
	if(!$hotel_photos){
		$lead_hotel_thumb_url = UPLOAD_HTTP_PERM."photo_thumb_no_photo.gif";
	}
	
	// Get reviews
	$params['tree_id'] = $hotel_values['tree_id'];
	$params['status'] = 'a';
	$hotel_reviews = $reviews->get_review_average($params);
	if($hotel_reviews){
		$hotel_reviews_list = $reviews->get_reviews($params);
	}
	// Get LURL of the reviews
	$lurl_review_add = $lurls->get_hotel_review_add_lurl($params['tree_id']);
	// Get LURL of the reviews
	$lurl_review_read = $lurls->get_hotel_review_lurl($params['tree_id']);
	unset($params);


	// Template
	$template = new template();
	$template->title = "Reviews of ".$hotel_values['name'].", ".$resort_values['name'].", ".$destination_values['name'];
	$template->meta_description = "Read reviews of ".$hotel_values['name'].", ".$resort_values['name']." from Irish holidays makers. Add you own holiday review for ".$destination_values['name'];
	$template->section_highlight = "guides";
	$template->left_col = true;
	$template->breadcrumbs_html = $breadcrumb->get_html_breadcrumb($hotel_values['lineage']);	
	$template->ld_head();
	
	
	
	
	


?>







<h2 title="Reviews of  <?= $hotel_values['name'] ?>">Reviews of <?= $hotel_values['name'] ?></h2>




<!-- Start hotel details -->

<div class="col_110">

<?
if($hotel_photos){
?>

<div class='thumb_cover_div'>
<a href="#"><img src="<?= $lead_hotel_thumb_url ?>" alt="<?= $hotel_values['name'] ?>" class="thumb_image_100" />
<img src="/images/thumb_cover_100_74.gif" class="thumb_cover" alt="<?= $destination['name'] ?>" /></a>	
</div>

<?
}
?>


</div>


<div class="col_310">


<p class="title_big"><?= $hotel_values['name'] ?></p>
<p class="title_med"><?= $resort_values['name'].", ".$destination_values['name'] ?></p>


<!-- Start rating -->
<p class="margin_bottom_3"><? if($hotel_values['hotel_rating']) echo output_rating($hotel_values['hotel_rating'], "star", true); ?>&nbsp;</p>
<!-- End rating -->







</div>






<div class="col_190">



<!-- Start send 2 + bookmark box -->
<div class="box_lb_190_cap">
<div class="box_lb_190_shoe">
<div class="padding_10">

<ul class="blank_list">
	<li class="link_fav"><a href="javascript:addToFavorites('<?= $template->title ?>', '<?= MAIN_SITE_ROOT.$_SERVER['REQUEST_URI'] ?>')">Bookmark this page</a></li>
</ul>

</div>
</div>
</div>
<!-- End send 2 + bookmark box -->




</div>

<div class="clearing"></div>




<!-- End hotel details -->








<br />





<h3 title="Reviews of <?= $hotel_values['name'] ?>">Reviews of <?= $hotel_values['name'] ?></h3>

<p><strong>Have you stayed at this hotel before?</strong> <a href="<?= $lurl_review_add ?>">Write your own review here &rsaquo;</a></p>


<? if($hotel_reviews){ ?>

<div class="box_lb_rev_title_610">
<div class="box_lb_rev_title_610_cap">
<div class="box_lb_rev_title_610_shoe">

<div class="box_padding">

<table>
    <tr>
        <td width="200">
        
<p class="no_margin"><strong>Overall rating </strong> <?= output_rating($hotel_reviews['0']['overall'], "rate", true); ?><br />
( Based on <?= $hotel_reviews['0']['num_reviews']?> reviews )</p>
        
        </td>
        <td width="390">
        
        <table>
            <tr>
                <td width="100">Location</td>
                <td width="80"><?= output_rating($hotel_reviews['0']['location'], "rate", true); ?></td>
                <td width="100">Facilities</td>
                <td width="80"><?= output_rating($hotel_reviews['0']['facilities'], "rate", true); ?></td>
            </tr>
            <tr>
                <td>Value</td>
                <td><?= output_rating($hotel_reviews['0']['value'], "rate", true); ?></td>
                <td>Cleanliness</td>
                <td><?= output_rating($hotel_reviews['0']['cleanliness'], "rate", true); ?></td>
            </tr>
        </table>        
        
        </td>
    </tr>
</table>



</div>

</div>
</div>
</div>



<br />

<?
foreach($hotel_reviews_list as $hotel_review){
?>
<!-- Start Review -->

<div class="box_lb_rev_610">
<div class="box_lb_rev_610_cap">
<div class="box_lb_rev_610_shoe">

<div class="box_padding_review">

<div class="col_390 margin_right_20">

<h4><?= $hotel_review['review_title'] ?></h4>
<p><?= $hotel_review['review'] ?></p>

<p class="no_margin"><em>Written by <strong><?= $hotel_review['reviewer_name'] ?></strong> on the <?= date('j F Y', $hotel_review['review_date']) ?></em></p>

</div>


<div class="col_180">
<h5><?= $hotel_review['reviewer_name'] ?>'s ratings</h5>
<table>
    <tr>
        <td width="100">Location</td>
        <td><?= output_rating($hotel_review['location'], "rate", true); ?></td>
    </tr>
    <tr>
        <td>Value</td>
        <td><?= output_rating($hotel_review['value'], "rate", true); ?></td>
    </tr>
    <tr>
        <td>Facilities</td>
        <td><?= output_rating($hotel_review['facilities'], "rate", true); ?></td>
    </tr>
     <tr>
        <td>Cleanliness</td>
        <td><?= output_rating($hotel_review['cleanliness'], "rate", true); ?></td>
    </tr>
     <tr>
        <td><strong>Overall rating</strong></td>
        <td><?= output_rating($hotel_review['overall'], "rate", true); ?></td>
    </tr>
</table>

</div>


<div class="clearing"></div>

</div>




</div>
</div>
</div>

<br />

<!-- End Review -->

<? } ?>


<ul class="list_qlinks no_margin">
    <li>Stayed at this hotel before?<a href="<?= $url_string_review_add ?>"> Write your own review</a></li>
</ul>


<? }else{ ?>

<p>This hotel has not yet been reviewed. Be the first to review it <a href="<?= $url_string_review_add ?>">here</a> </p>


<? } ?>


<p style="margin-top:12px;"><a rel="nofollow"  class="qlink" style="text-decoration: none; font-weight:bold; color:#333333" href="http://www.holidayreviews.ie">Hotel Reviews provided by <img style="display:inline; vertical-align:middle" src="/images/icon_holiday_reviews.png" alt="HolidayReviews.ie" /></a></p>



<?


$template->ld_foot();

	
?>